<!DOCTYPE HTML>
<html>
<head th:include="/common/head :: head"></head>
<style>
	.row-fluid{
		max-width: 1024px;
    	/* margin: 0 auto; */
	}
	.table th{
		font-size: 24px;
		font-weight: bold;
	}
	.detailTable tbody td:nth-child(1),td:nth-child(3){
		text-align:left;
		min-width:150px;
		
	}
	.table td{
		font-size: 16px;
		font-family: Microsoft YaHei;
	}

</style>
<body class="pos-r">
	<div>

		<nav class="breadcrumb" th:include="/common/navbar :: navbar('用户管理','个人活动信息')"></nav>

		
		<div class="container-fluid">
			<div class="row-fluid">
			
				<table class="table table-hover detailTable">
					<thead>	
						<tr>
							<th colspan="4"> 基本信息 </th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>账号:</td><td th:text="${entity.userCode}"></td>
							<td>&nbsp;</td><td>&nbsp;</td>
						</tr>
						<tr>
							<td>姓名:</td><td th:text="${entity.name}"></td>
							<td>地址:</td><td th:text="${entity.provinceEntity!=null? entity.provinceEntity.name+entity.cityEntity.name+entity.districtEntity.name:''}"></td>
						</tr>
						<tr>
							<td>手机号:</td><td th:text="${entity.mobile}"></td>
							<td>公司</td><td th:text="${entity.company}"></td>
						</tr>
						<tr>
							<td>邮箱:</td><td th:text="${entity.email}"></td>
							<td>职务:</td><td th:text="${entity.position}"></td>
						</tr>
						<tr>
							<td>擅长领域:</td><td th:text="${entity.adeptField}"></td>
							<td>著作:</td>
							<td>
								<textarea class="textarea radius" readonly="readonly" th:utext="${entity.writings}"></textarea> 
							</td>
						</tr>
						<tr>
							<td>荣誉:</td>
							<td>
								<textarea class="textarea radius" readonly="readonly" th:utext="${entity.honor}"></textarea> 
							</td>
							<td>能力/经验:</td>
							<td >
								<textarea class="textarea radius" readonly="readonly" th:utext="${entity.intro}"></textarea> 
							</td>
						</tr>
						<tr>
							<td colspan="4" style="text-align:center;">
								<button onClick="toBack();"  class="btn btn-primary radius" ><i class="Hui-iconfont">&#xe66b;</i> 返回 </button>
							</td>
						</tr>
					</tbody>
				</table>
			
			
				<table class="table table-hover detailTable">
					<thead>	
						<tr> <th colspan="4"> 系统信息 </th> </tr>
					</thead>
					<tbody>
						<tr>
							<td>用户类型:</td><td th:text="${entity.user != null} ? ${entity.user.userType.value} :  '' "></td>
							
							<td>注册时间:</td><td th:text="${entity.user != null ? #dates.format(entity.user.registrationTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td>
						</tr>
<!-- 						<tr> -->
<!-- 							<td>注册时间:</td><td th:text="${entity.user != null ? #dates.format(entity.user.registrationTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td> -->
<!-- 							<td>入会审核时间：</td><td th:text="${member!=null and member.auditTime != null ? #dates.format(member.auditTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td> -->
<!-- 						</tr> -->
<!-- 						<tr> -->
<!-- 							<td>入会审核人员:</td><td th:text="${member!=null?member.auditUser:''}"></td> -->
<!-- 							<td>入会说明：</td><td th:text="${member!=null?member.auditDescription:''} "></td> -->
<!-- 						</tr> -->
					</tbody>
				</table>
				
				
				<table class="table table-hover detailTable">
					<thead>	
						<tr> <th colspan="4"> 活动信息 </th> </tr>
					</thead>
					<tbody>
						<tr>
							<td>活动审核人员：</td><td th:text="${entity.auditUser}"></td>
							<td>报名时间：</td><td th:text="${entity.applicationTime != null ? #dates.format(entity.applicationTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td>
						</tr>
						<tr>
							<td>活动审核说明：</td><td th:text="${entity.auditDescription}"></td>
							<td>活动审核时间：</td><td th:text="${entity.auditTime != null ? #dates.format(entity.auditTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td>
						</tr>
						<tr>
							<td>取消活动备注：</td><td th:text="${entity.cancelReason}"></td>
							<td>取消活动时间：</td><td th:text="${entity.cancelTime != null ? #dates.format(entity.cancelTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td>
						</tr>
					</tbody>
				</table>
				
				
				
				<table class="table table-hover ">
					<thead>	
						<tr> <th colspan="4"> 活动审核</th> </tr>
						<tr th:unless="${entity.auditStatus.value =='待审核' }">
							<td colspan="4"  >
							审核结果  <span id="auditResult" style="margin-left: 15px;" th:text="${entity.auditStatus.value}"></span>
							</td>
						</tr>						
					</thead>

					<tbody th:if="${entity.auditStatus.value =='待审核' }">
						<tr>
							<td colspan="2" style="text-align: right;">
								<button class="btn btn-primary radius size-L  actiAuditButton"  data-value="P" th:text="通过"></button>
							</td>
							
							<td colspan="2">
								<button class="btn btn-primary radius size-L actiAuditButton" data-value="N" th:text="未通过"></button>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>

	
	
	<!-- 弹出窗口 -->
	<div id="actiAuditModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content radius">
				<div class="modal-header">
					<h3 class="modal-title">审核说明</h3>
					<a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
				</div>
				<div class="modal-body">
					<label>说明</label>
 					<textarea class="textarea radius"  id="auditDescription"></textarea> 
				</div>
				<div class="modal-footer">
					<button class="btn btn-primary actiAuditConfirm" >确定</button>
					<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
				</div>
			</div>
		</div>
	</div>
	
	
	<input type="hidden" id="status" />
	<input type="hidden" id="id" name="id" th:value="${entity.id}" />
	<input type="hidden" id="activityId" th:value="${entity.activityId}"/>
	
	<script type="text/javascript" src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>


<script type="text/javascript">

$(function(){
	$(".actiAuditButton").on("click",function(){
		$("#status").val($(this).data("value"));
		$('#actiAuditModal').modal('show');
		
	})
	
	$(".actiAuditConfirm").on("click",function(){
		
		//逻辑处理
		var auditDescription = $("#auditDescription").val();
		var auditResultText = "通过";
		var auditResult = $("#status").val();
		var id = $("#id").val();
		
		if(auditResult == "N"){
			auditResultText = "未通过";
		}
		
    	$.ajax({
               type : "POST",
               url : "/activity/user/updateAudit",
               data : {
            	   id : id,               
            	   auditDescription : auditDescription,
            	   auditStatus : auditResultText
	       	   },
               success : function(data){
            	  // $.Huimodalalert('操作成功',2000);
            	  alert("操作成功!");
            	   window.location.replace("/activity/user/view?id="+id);
	   			  // $("#auditResult").text(auditResultText);
                  },
	       	   error : function(data){
	       		  $.Huimodalalert('操作失败',2000);
        	   }
         }); 
    	$('#actiAuditModal').modal('hide');

	})
	
})
</script>
</body>
</html>